<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <form action="">
        <p>账号：<br><input type="text" id="account"></p>
        <p>密码：<br><input type="text" id="password"></p>
        <p><input type="button" value="登录" id="loginBtn"></p>
    </form>

    <script>
        // document.getElementById("loginBtn").onclick=function(){}

        //使用jq
        $("#loginBtn").on("click", function () {
            var account = $("#account").val;
            var password = $("#password").val;

            //对象简写的应用场景。
            var params={account,password};
            //执行异步请求
            $.ajax({
                type: "post",
                url:"xxx",
                data: params,
                success(){

                }
            });

        });
    </script>
</body>

</html>